home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
magazine
/
progjour
/
1991
/
01
/
b_constr.c
< prev
next >
Wrap
Text File
|
1990-10-31
|
674b
|
28 lines
/* b_construct.c -- Listing 3. */
#include <stdlib.h>
#include "textbuf.h"
PUBLIC textbuf *b_construct( textbuf *b, int nrows, int ncols )
{
/* Initialize a textbuf, Return b on success, NULL on failure */
bufsize asize = nrows * ncols;
if( asize >= MAXBSIZE ) /* Won't fit in an 8086 segment */
b = NULL;
else if( !(b->buf = BMALLOC(asize)) ) /* get the actual buffer */
b = NULL;
else
{
b->nrows = nrows;
b->ncols = ncols;
b->row = 0;
b->col = 0;
b->p = b->buf;
b_clearbuf( b, ' ' );
b->magic = B_MAGIC;
}
return b;
}